import { createRouter, createWebHistory } from 'vue-router'
import LayOut from '../LayOut'

const routes = [
  {
    path: '/',
    name: 'layout',
    component: LayOut,
    children: [
      {
        path: '/',
        redirect: '/dashBoard'
      },
      {
        path: '/dashBoard',
        name: 'dashBoard',
        component: () => import('../views/dashBoard')
      },
      {
        path: '/bannerManager',
        name: 'bannerManager',
        component: () => import('../views/bannerManager')
      },
      {
        path: '/shopManager',
        name: 'shopManager',
        component: () => import('../views/shopManager')
      },
      {
        path: '/userManager',
        name: 'userManager',
        component: () => import('../views/userManager')
      },
      {
        path: '/orderManager',
        name: 'orderManager',
        component: () => import('../views/orderManager')
      },
      {
        path: '/classManager',
        name: 'classManager',
        component: () => import('../views/classManager')
      }
    ]
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/login')
  },
  // 404页
  {
    path: '/:pathMatch(.*)*',
    name: 'NotFound',
    component: () => import('../views/notFound')
  }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
